package com.atguigu.gulimall.cart.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class GulimallWebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getCartInterceptor())//注册拦截器(注意这里是调用方法
                .addPathPatterns("/**");
    }


    @Bean
    public CartInterceptor getCartInterceptor(){
        return new CartInterceptor();
    }
}
